package com.lagou.config;

import com.lagou.common.util.DataBaseConfig;
import com.lagou.common.zk.ConfigCenter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ZdyConfigApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(ZdyConfigApplication.class, args);

        initDataSource();
    }

    private static void initDataSource() throws Exception {
        DataBaseConfig config = new DataBaseConfig();
        config.setDriverClassName("com.mysql.cj.jdbc.Driver");
        config.setUrl("jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false");
        config.setDbname("test");
        config.setUsername("root");
        config.setPassword("root");
        ConfigCenter.registerConfig(config);
    }
}
